Visual Basic (Declaration) | |
---|---|
Public Overloads Function AddRange( _ ByVal unorderedItems As IEnumerable(Of KeyValuePair(Of TKey,TValue)), _ ByVal allowUpdates As Boolean _ ) As Integer |
C# | |
---|---|
public int AddRange( IEnumerable<KeyValuePair<TKey,TValue>> unorderedItems, bool allowUpdates ) |
Parameters
- unorderedItems
- The items to insert
- allowUpdates
- True to overwrite any existing records
Return Value
The total number of records inserted or updatedBPlusTree/BPlusTree.Test/BasicTests.cs
C# | Copy Code |
---|---|
Stopwatch sw = Stopwatch.StartNew(); var options = Options.Clone(); using (TempFile temp = new TempFile()) { //using (BPlusTree<int, string> data = Create(Options)) using (BPlusTree<int, string> data = Create(options)) { const bool bulk = true; Insert(data, CreateRandom(1000, 3000), bulk, false); data.EnableCount(); Assert.AreEqual(1000, data.Count); Insert(data, CreateCount(data.Last().Key + 1, 1, 1000), bulk, true); Assert.AreEqual(2000, data.Count); Insert(data, CreateCount(data.Last().Key + 10001, -1, 1000), bulk, false); Assert.AreEqual(3000, data.Count); int lastKey = data.Last().Key; data.AddRange(CreateCount(1, 2, lastKey / 2), true); } temp.Dispose(); } Trace.WriteLine("Inserted in " + sw.Elapsed); |
VB.NET | Copy Code |
---|---|
Dim sw As Stopwatch = Stopwatch.StartNew() Dim options As var = Options.Clone() Using temp As New TempFile() 'using (BPlusTree<int, string> data = Create(Options)) Using data As BPlusTree(Of Integer, String) = Create(options) Const bulk As Boolean = True Insert(data, CreateRandom(1000, 3000), bulk, False) data.EnableCount() Assert.AreEqual(1000, data.Count) Insert(data, CreateCount(data.Last().Key + 1, 1, 1000), bulk, True) Assert.AreEqual(2000, data.Count) Insert(data, CreateCount(data.Last().Key + 10001, -1, 1000), bulk, False) Assert.AreEqual(3000, data.Count) Dim lastKey As Integer = data.Last().Key data.AddRange(CreateCount(1, 2, lastKey / 2), True) End Using temp.Dispose() End Using Trace.WriteLine("Inserted in " + sw.Elapsed) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7